<?php
/**
 * The main template file
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * For example, it puts together the home page when no home.php file exists.
 *
 * @link http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Twelve
 * @since Twenty Twelve 1.0
 */

get_header(); ?>
<?php $query_hot = new WP_Query( array(
    'orberyby' => 'modified',
    'posts_per_page' => 5
)); 
?>
	<div id="primary" class="site-content">
	<div id="sidebar-right-1" class="widget-area" role="complementary">
	<?php get_template_part('leftnavigation');?>
	<?php if ( is_active_sidebar( 'right-1' ) ) : ?>
		<?php dynamic_sidebar( 'right-1' ); ?>
		<?php endif; ?>	</div><!-- #secondary -->
		<div id="content" class="threecolumn">
		<div id="hometop">
		<?php 
		$i = 0;
		while($query_hot->have_posts()) : $query_hot->the_post();
		if($i ==0) {
		?>
		<div id="hometopview" class="clearfix">
        <a class="title" href="<?php the_permalink(); ?>"><?php the_title(); ?> <em></em>

                            <i><?php echo get_post_meta(get_the_ID(), 'soft_title_description', true);?></i>

</a>

        <a href="<?php the_permalink(); ?>">
		<?php the_post_thumbnail('index-hot-thumb'); ?>
		<?php //echo get_the_post_thumbnail(get_the_ID(),array(180,180));?></a>

        <div class="publisher-info">

            <span>Phát hành bởi <b>

                <a href="<?php echo get_the_publisher_link();?>"><?php echo get_the_publisher_name();?></a>

            </b></span>

        </div>
            <div class="briefinfo"><?php the_excerpt(); ?></div>
            <div class="downloadtimes">

                <label>

                    Lượt tải:

                </label>

                5.367
            </div>

                    <div class="operationsystems">

                <label>

                    Phiên bản:

                </label>

                <span><?php echo get_post_meta(get_the_ID(), 'soft_version', true);?></span>

            </div>

                    <div class="operationsystems">

                <label> Yêu cầu:</label> 
                <span><?php echo get_post_meta(get_the_ID(), 'soft_requirements_os', true);?></span>
            </div>
    </div>
	<ul class="highline">
	<?php
	} else { //end i ==0?>
	
            <li>
			<span class="highline-news"><?php echo $i;?></span>
                <a href="<?php the_permalink(); ?>">

                    <b><?php the_title(); ?></b>                                 <em></em>

                         <i><?php echo get_post_meta(get_the_ID(), 'soft_title_description', true);?></i>

                    <span class="average-rating-stars average-rating-stars-4"></span>
                </a>
               <span class="downloadtimes"><?php get_the_count_download() ?></span>
            </li>
      
    
	<?php 
	
	 } //end if i ==0
	 $i++;
	endwhile; wp_reset_postdata(); // reset the query ?>
	</ul>
	</div>
		<?php if ( have_posts() ) : ?>

			<?php /* Start the Loop */ ?>
			<?php while ( have_posts() ) : the_post(); ?>
				<?php get_template_part( 'content-list', get_post_format() ); ?>
			<?php endwhile; ?>

			<?php //twentytwelve_content_nav( 'nav-below' ); ?>

		<?php else : ?>

			<article id="post-0" class="post no-results not-found">

			<?php if ( current_user_can( 'edit_posts' ) ) :
				// Show a different message to a logged-in user who can add posts.
			?>
				<header class="entry-header">
					<h1 class="entry-title"><?php _e( 'No posts to display', 'twentytwelve' ); ?></h1>
				</header>

				<div class="entry-content">
					<p><?php printf( __( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'twentytwelve' ), admin_url( 'post-new.php' ) ); ?></p>
				</div><!-- .entry-content -->

			<?php else :
				// Show the default message to everyone else.
			?>
				<header class="entry-header">
					<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1>
				</header>

				<div class="entry-content">
					<p><?php _e( 'Apologies, but no results were found. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p>
					<?php get_search_form(); ?>
				</div><!-- .entry-content -->
			<?php endif; // end current_user_can() check ?>

			</article><!-- #post-0 -->

		<?php endif; // end have_posts() check ?>

		</div><!-- #content -->
	</div><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>